﻿using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using unTroublemaker.Parsing;

namespace unTroublemaker.Tests.Parsing
{
    [TestClass]
    public class AnyConditionTests
    {
        private SpecificationParser _specificationParser;
        private AnyConditionParser _anyParser;

        public TestContext TestContext { get; set; }

        [TestInitialize]
        public void Initialize()
        {
            _specificationParser = new SpecificationParser();
            _anyParser = new AnyConditionParser();
        }

        [TestMethod, TestCategory("UnitTest")]
        public void GivenAnAnyConditionWithASingleSubConditionCanParse()
        {
            var any = new XElement("any", new XElement("check-file-exists", new XAttribute("path", "C:\\Windows\\System32\\cmd.exe")));

            var condition = _anyParser.Parse(any, _specificationParser);
            condition.Run();
            Assert.IsTrue(condition.Passed);
        }
    }
}
